using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using BA.DAL;
using Microsoft.VisualBasic;


namespace BlazeApps.Library.Reports
{
    public class ReportList : Base
    {
        private BA.DAL.DBUtility DAL = new BA.DAL.DBUtility();
        private Procedures Procs = new Procedures();

        public DataSet GetTopNItemsByType(int NumberToDisplay, ItemType Type)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@itemtype", DbType.Int32, ((int)(Type)));
            DAL.AddParameter("@numbertodisplay", DbType.Int32, NumberToDisplay);

            return DAL.GetDataSet(Procs.ListTopNItemsByType.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetTopNItemsMostViewed(int NumberToDisplay, ItemType Type)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@numbertodisplay", NumberToDisplay);
            DAL.AddParameter("@itemtype", Type);

            return DAL.GetDataSet(Procs.ListTopNItemsMostViewed.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetTopNItemsMostComments(int NumberToDisplay, ItemType Type)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@numbertodisplay", NumberToDisplay);
            DAL.AddParameter("@itemtype", Type);

            return DAL.GetDataSet(Procs.ListTopNItemsMostComments.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetTopNItemsHighestRank(int NumberToDisplay, ItemType Type)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@numbertodisplay", NumberToDisplay);
            DAL.AddParameter("@itemtype", Type);

            return DAL.GetDataSet(Procs.ListTopNItemsHighestRank.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetTopNExpiredPages(int NumberToDisplay)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);
            
            DAL.AddParameter("@numbertodisplay", NumberToDisplay);

            return DAL.GetDataSet(Procs.ListTopNExpiredPages.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetRSSByItem(Guid ItemID)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@ItemID", ItemID);

            return DAL.GetDataSet(Procs.ListRSSByItem.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }
    }
}
